package com.sgzn.sgpay.model.response.result.util;

import lombok.Data;
import lombok.ToString;

import java.io.Serializable;

/**
 * 分页响应基类
 * @author zhongzhongyong
 * @version Id: PageResponse.java, v 0.1 2018/4/25 23:26 zhongzhongyong Exp $$
 */
@Data
@ToString
public class PageResponse implements Serializable{

    public static final int DEFAULT_PAGE_SIZE = 10;
    private static final long serialVersionUID = -2050903899112211502L;

    private int pageSize;
    private int currentPage;
    private int totalPage;
    private int totalCount;

    public PageResponse() {
        this.currentPage = 1;
        this.pageSize = DEFAULT_PAGE_SIZE;
    }

    /**
     *
     * @param currentPage
     * @param pageSize
     */
    public PageResponse(int currentPage, int pageSize) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
    }

    public int getCurrentPage() {
        return currentPage <= 0 ?1 : currentPage;
    }

    public int getPageSize() {
        return pageSize <= 0 ?10 : pageSize;
    }

}
